/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package javaapplication1;

import java.io.BufferedReader;
import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.IOException;

/**
 *
 * @author new
 */
public class CommentHandler {

    public int deleteComment(String fileName) throws FileNotFoundException, IOException{
        String temp = "CommentTemp";
        FileHandler fh = new FileHandler();
        BufferedReader br = fh.openReadFile(fileName);
        BufferedWriter bw = fh.openWriteFile(temp);
        String splitStr[] = new String[2];
        
        String tempStr = br.readLine();
        while(tempStr != null){
            splitStr = tempStr.split(";", 2);
            bw.append(splitStr[0]);
            bw.newLine();
            tempStr = br.readLine();
        }
        br.close();
        bw.close();
        System.gc();
        fh.replaceFile(temp, fileName);

        return 0;
    }
}
